import { createRouter, createWebHashHistory } from 'vue-router'
import loginView from "@/views/login.vue"
import categoryView from "@/views/main/category.vue"
import boxView from "@/views/box.vue"
import addArticle from "@/views/add/addArticle.vue"

export const menus = [
    {
      path: '/category/show',
      name: 'show-category',
      component: categoryView,
        meta:{
            title:"栏目"
        }
    },
    {
      path: '/article/show',
      name: 'show-article',
      component: () => import('@/views/main/article.vue'),
        meta:{
            title:"文章"
        }
    },
    {
      path: '/tag/show',
      name: 'show-tag',
      component: () => import('@/views/main/tag.vue'),
        meta:{
            title:"标签"
        }
    },
]

const actions = [
    {
      path: '/article/add',
      name: 'add-article',
      component: addArticle
    },
    {
      path: '/article/update',
      name: 'update-article',
      component: () => import('@/views/edit/article.vue')
    },
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: loginView
    },
    {
        path:"/main",
        name:"frame",
        component:boxView,
        children:menus,
    },
    {
        path:"/actions",
        name:"actions",
        component:boxView,
        children:actions,
    }
  ]
})

export default router
